#include<iostream>
#include<math.h>
using namespace std;
int w,m,n;
int main()
{
    cin>>w>>m>>n;
    m--,n--;
    int x1=m/w;
    int x2=n/w;
    int y1,y2;
    if(x1%2!=0)y1=w-1-m%w;
    else y1=m%w;
    if(x2%2!=0)y2=w-1-n%w;
    else y2=n%w;
    cout<<abs(x1-x2)+abs(y1-y2);
}